

****====Replication codes for Mass Mobilization, Elite Competition, and Diversionary Use of Sanctions====
* Author: Ryan Yu-Lin Liou
* Version: Stata 14.2
* Unit of analysis: country-years 


clear all
use "DiversionarySanctions_Main.dta", clear 

*** Main Models: Multinomial Logit (TIES)		
mlogit diversion i.lbinonvio_campaign##c.loppseatshare i.lbivio_campaign##c.loppseatshare lgdpgr llninflation Flegelec Fexelec llngdppc ltradeopen llnmilex lvdem_polyarchy lagtheta_mean i.coldwar yrssince_divert yrssince_divertsq yrssince_divertcubic if year >1974 & year <2006, vce(cluster ccode)	

sum diversion lbinonvio_campaign lbivio_campaign loppseatshare lgdpgr llninflation Flegelec Fexelec llngdppc ltradeopen llnmilex lvdem_polyarchy lagtheta_mean coldwar yrssince_divert  if e(sample)==1
* check coorelation   
cor loppseatshare lvdem_polyarchy if e(sample)==1 
* 0.659

* Table 1
outreg2 using Table1, word replace alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*, †) bdec(3) addtext(Countries, 137)

* Figure 1
sum loppseatshare if e(sample)==1
margins, dydx(lbinonvio_campaign) at(loppseatshare =(0(0.1)0.89)) predict(outcome(1))
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) scheme(s2mono) yline(0, lpattern(line))  ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Opposition Seat Share, size(medium)) ytitle(Change in Probability of Sanction Imposition, size(medium)) yscale(titlegap(+2)) xscale(titlegap(+2)) ///
addplot(hist loppseatshare if e(sample)==1, percent fcolor(none) lcolor(gray) xlabel(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) 
graph export "Figure 1.png", replace		



* Table A2 (interaction with democracy and include opposition seat shares)
mlogit diversion i.lbinonvio_campaign##c.lvdem_polyarchy i.lbivio_campaign##c.lvdem_polyarchy loppseatshare lgdpgr llninflation Flegelec Fexelec llngdppc ltradeopen llnmilex lagtheta_mean i.coldwar yrssince_divert yrssince_divertsq yrssince_divertcubic if year >1974 & year <2006, vce(cluster ccode)	
outreg2 using TableA2, word replace alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*, †) bdec(3) addtext(Countries, 137)

margins, dydx(lbinonvio_campaign) at(lvdem_polyarchy =(0(0.1)0.93)) predict(outcome(1))
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) scheme(s2mono) yline(0, lpattern(line))  ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Democracy, size(medium)) ytitle(Change in Probability of Sanction Imposition, size(medium)) yscale(titlegap(+2)) xscale(titlegap(+2)) ///
addplot(hist loppseatshare if e(sample)==1, percent fcolor(none) lcolor(gray) xlabel(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) 
graph export "Figure A2.png", replace		
	
margins, dydx(lbivio_campaign) at(lvdem_polyarchy =(0(0.1)0.9)) predict(outcome(1))
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) scheme(s2mono) yline(0, lpattern(line))  ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Democracy, size(medium)) ytitle(Change in Probability of Sanction Imposition, size(medium)) yscale(titlegap(+2)) xscale(titlegap(+2)) ///
addplot(hist loppseatshare if e(sample)==1, percent fcolor(none) lcolor(gray) xlabel(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) 
graph export "Figure A3.png", replace		



* Table A3 (interaction with democracy and exclude opposition seat shares)
mlogit diversion i.lbinonvio_campaign##c.lvdem_polyarchy i.lbivio_campaign##c.lvdem_polyarchy lgdpgr llninflation Flegelec Fexelec llngdppc ltradeopen llnmilex lagtheta_mean i.coldwar yrssince_divert yrssince_divertsq yrssince_divertcubic if year >1974 & year <2006, vce(cluster ccode)	
outreg2 using TableA3, word replace alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*, †) bdec(3) addtext(Countries, 137)

margins, dydx(lbinonvio_campaign) at(lvdem_polyarchy =(0(0.1)0.93)) predict(outcome(1))
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) scheme(s2mono) yline(0, lpattern(line))  ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Democracy, size(medium)) ytitle(Change in Probability of Sanction Imposition, size(medium)) yscale(titlegap(+2)) xscale(titlegap(+2)) ///
addplot(hist loppseatshare if e(sample)==1, percent fcolor(none) lcolor(gray) xlabel(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) 
graph export "Figure A4.png", replace		

margins, dydx(lbivio_campaign) at(lvdem_polyarchy =(0(0.1)0.9)) predict(outcome(1))
marginsplot, level(95) recast(line) recastci(rline) ciopts(lpattern(dash) lcolor(black)) scheme(s2mono) yline(0, lpattern(line))  ///
title("") plotopts(lcolor(black) plotregion(color(white)) graphregion(color(white)))  ///
xtitle(Democracy, size(medium)) ytitle(Change in Probability of Sanction Imposition, size(medium)) yscale(titlegap(+2)) xscale(titlegap(+2)) ///
addplot(hist loppseatshare if e(sample)==1, percent fcolor(none) lcolor(gray) xlabel(0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9) ///
yaxis(2) ytitle(Percent of Sample, axis(2)) yscale(axis(2) alt)) legend(off) 
graph export "Figure A5.png", replace		


	
* Table A4 GSDB
clear all
use "DiversionarySanctions_GSDB.dta", clear 
mlogit diversion_gsdb i.lbinonvio_campaign##c.loppseatshare i.lbivio_campaign##c.loppseatshare lgdpgr llninflation Flegelec Fexelec llngdppc ltradeopen llnmilex lvdem_polyarchy lagtheta_mean i.coldwar yrssince_divertgsdb yrssince_divertsqgsdb yrssince_divertcubicgsdb if year >1974 & year <2014, vce(cluster ccode)		
outreg2 using TableA4, word replace alpha(0.001, 0.01, 0.05, 0.1) symbol(***,**,*, †) bdec(3) addtext(Countries, 151)



